<template>
    <el-form ref="form" :model="form" label-width="120px">

        <el-form-item label="用户提交结果" prop="result">
            <div v-if="userWork.type==3">
                <a :href="userWork.result" download>download</a>
            </div>
        </el-form-item>
        <el-form-item label="评分" prop="mark">
            <el-input-number v-model="form.mark" :max="100" :min="0" clearable></el-input-number>
        </el-form-item>
        <el-form-item>
            <el-button type="primary" @click="onSubmit">完成</el-button>
        </el-form-item>
    </el-form>
</template>

<script>
    export default {
        props: {userWork: Object}, data() {
            return {
                form: {
                    mark: null,
                }
            }
        }, methods: {
            onSubmit() {
                console.log(this.userWork);
                axios.put('user-work', {
                    user_id: this.userWork.user_id,
                    work_id: this.userWork.work_id,
                    mark: this.form.mark
                }).then(res => {
                    this.$emit('complete');
                    this.$message.success('成功评分');
                });
            }
        }
    }
</script>

<style scoped>

</style>